﻿using System;
using System.Linq;
using System.Text;

namespace YJKSump.Forms
{
	internal class HYIntIncreaseCombox : HYintComBox
	{
		private void AddItem(string strText)
		{
			if (this.GetLongText(ref strText) == 0L)
			{
				return;
			}
			if (!base.Items.Contains(strText))
			{
				base.Items.Add(strText);
			}
		}

		protected override void OnDropDown(EventArgs e)
		{
			string text = base.Text;
			this.AddItem(text);
			base.OnDropDown(e);
		}

		protected override void OnMouseLeave(EventArgs e)
		{
			string text = base.Text;
			this.AddItem(text);
			base.OnMouseLeave(e);
		}

		private long GetLongText(ref string strText)
		{
			strText = strText.ToInt(0).ToString();
			if (!strText.IsEmpty<char>() && strText[0] == '-')
			{
				return strText.LongCount<char>() - 1L;
			}
			return strText.LongCount<char>();
		}
	}
}
